﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class CollectDiamond : MonoBehaviour
{
    public AudioSource collectSound;
    public Text scoreText;
    int score;

    void Awake()
    {
        score = ScoringSystem.theScore;
        scoreText.text = score.ToString ();
    }

    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.CompareTag("Diamond"))
        {
            collectSound.Play();
            score = score + 1;
            scoreText.text = score.ToString();
            other.gameObject.SetActive(false);
        }

    }
}
